<html>
<head><meta charset="utf-8"><title>maybeuninit not copy · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html">maybeuninit not copy</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="178175240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178175240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178175240">(Oct 15 2019 at 09:28)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> why isn't MaybeUninit Copy ?</p>



<a name="178175671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178175671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178175671">(Oct 15 2019 at 09:35)</a>:</h4>
<p>It is? (If T is)</p>



<a name="178175702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178175702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178175702">(Oct 15 2019 at 09:35)</a>:</h4>
<p>Why the "If T is" constraint ?</p>



<a name="178175723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178175723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178175723">(Oct 15 2019 at 09:36)</a>:</h4>
<p>(why isn't it unconditionally Copy?)</p>



<a name="178176202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178176202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178176202">(Oct 15 2019 at 09:43)</a>:</h4>
<p>Feels like a footgun possibly</p>



<a name="178177325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178177325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178177325">(Oct 15 2019 at 10:01)</a>:</h4>
<p>Is there rationale for this somewhere?</p>



<a name="178177830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178177830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178177830">(Oct 15 2019 at 10:09)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/53491#issuecomment-443477750" target="_blank" title="https://github.com/rust-lang/rust/issues/53491#issuecomment-443477750">https://github.com/rust-lang/rust/issues/53491#issuecomment-443477750</a></p>



<a name="178177937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178177937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178177937">(Oct 15 2019 at 10:10)</a>:</h4>
<p>I wish there was a Copy wrapper type so that I could just write <code>MaybeUninit&lt;CopyWrapper&lt;NotCopy&gt;&gt;</code></p>



<a name="178177957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178177957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178177957">(Oct 15 2019 at 10:11)</a>:</h4>
<p>Otherwise <code>MaybeUninit</code> cannot be used with <code>!Copy</code> types</p>



<a name="178177992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178177992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178177992">(Oct 15 2019 at 10:11)</a>:</h4>
<p>The current warning that says that code should stop using <code>mem::uninitialized</code> and use <code>MaybeUninit</code> instead is therefore being emitted too early</p>



<a name="178178045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178178045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178178045">(Oct 15 2019 at 10:12)</a>:</h4>
<p>Since if the type involved is not <code>Copy</code>, then you can't use <code>MaybeUninit</code> for it</p>



<a name="178178392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178178392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178178392">(Oct 15 2019 at 10:17)</a>:</h4>
<p>Opened: <a href="https://github.com/rust-lang/rust/issues/65432" target="_blank" title="https://github.com/rust-lang/rust/issues/65432">https://github.com/rust-lang/rust/issues/65432</a></p>



<a name="178178667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178178667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178178667">(Oct 15 2019 at 10:20)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span>  yea we can add a "note: ..." to impl Copy</p>



<a name="178179230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179230">(Oct 15 2019 at 10:28)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> </p>
<blockquote>
<p>Otherwise MaybeUninit cannot be used with !Copy types</p>
</blockquote>
<p>Wait, but it can ?</p>



<a name="178179242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179242">(Oct 15 2019 at 10:28)</a>:</h4>
<p><code>MaybeUninit&lt;NotCopy&gt;</code> works ?</p>



<a name="178179252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179252">(Oct 15 2019 at 10:29)</a>:</h4>
<p><code>T: Copy =&gt; MaybeUninit&lt;T&gt;: Copy</code></p>



<a name="178179272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179272">(Oct 15 2019 at 10:29)</a>:</h4>
<p>Sure, but MaybeUninit is a union, and if T is not Copy, then that would create an union with a NonCopy field</p>



<a name="178179273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179273">(Oct 15 2019 at 10:29)</a>:</h4>
<p><code>WF(MaybeUninit&lt;T&gt;)</code> does not require <code>T: Copy</code></p>



<a name="178179294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179294">(Oct 15 2019 at 10:29)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span>  did you assume ^--- ?</p>



<a name="178179363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179363">(Oct 15 2019 at 10:30)</a>:</h4>
<p>I was trying to play with my own maybeuninit, and got the mem::uninitialized warning</p>



<a name="178179388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179388">(Oct 15 2019 at 10:30)</a>:</h4>
<p>(and with ManuallyDrop)</p>



<a name="178179403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179403">(Oct 15 2019 at 10:30)</a>:</h4>
<p>So you only need <code>T: Copy</code> if you need the whole <code>MaybeUninit&lt;T&gt;</code> to also be <code>Copy</code></p>



<a name="178179418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179418">(Oct 15 2019 at 10:31)</a>:</h4>
<p>is that what you need tho?</p>



<a name="178179535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179535">(Oct 15 2019 at 10:33)</a>:</h4>
<p>I wanted the whole <code>MaybeUninit&lt;T&gt;</code> to be <code>Copy</code> even if <code>T</code> is not <code>Copy</code> to be able to put it into an union</p>



<a name="178179547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179547">(Oct 15 2019 at 10:33)</a>:</h4>
<p>but that cannot work</p>



<a name="178179557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179557">(Oct 15 2019 at 10:33)</a>:</h4>
<p>I've seen <a href="https://github.com/rust-lang/rust/issues/65432" target="_blank" title="https://github.com/rust-lang/rust/issues/65432">#65432</a> and I still don't understand why Copy would ever be relevant for replacing mem::uninit with MaybeUninit</p>



<a name="178179559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179559">(Oct 15 2019 at 10:33)</a>:</h4>
<p>yet somehow MaybeUninit makes it work</p>



<a name="178179579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179579">(Oct 15 2019 at 10:33)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span>  I think the larger context might be missing here</p>



<a name="178179588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179588">(Oct 15 2019 at 10:33)</a>:</h4>
<p>+/- some code</p>



<a name="178179591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179591">(Oct 15 2019 at 10:33)</a>:</h4>
<p>^ Can you please take a step back and explain from the start, from first principles, what the problem is</p>



<a name="178179694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179694">(Oct 15 2019 at 10:35)</a>:</h4>
<p>I wanted to put a <code>MaybeUninit&lt;T: !Copy&gt;</code> in a field that requires <code>Copy</code></p>



<a name="178179700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179700">(Oct 15 2019 at 10:35)</a>:</h4>
<p>that happened to be an <code>union</code> field</p>



<a name="178179718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179718">(Oct 15 2019 at 10:35)</a>:</h4>
<p>that did not work on stable</p>



<a name="178179776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179776">(Oct 15 2019 at 10:36)</a>:</h4>
<p>If T is not Copy, then you can't put the T there directly (using mem::uninitialized instead of MaybeUninit) either</p>



<a name="178179783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179783">(Oct 15 2019 at 10:36)</a>:</h4>
<p>I tried to use <code>ManuallyDrop</code> like <code>MaybeUninit</code> does but that did not work</p>



<a name="178179803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179803">(Oct 15 2019 at 10:37)</a>:</h4>
<p>I concluded without checking that <code>MaybeUninit&lt;T&gt;</code> can therefore not work for <code>T: !Copy</code></p>



<a name="178179806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179806">(Oct 15 2019 at 10:37)</a>:</h4>
<p>But it does, because its magic</p>



<a name="178179820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179820">(Oct 15 2019 at 10:37)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> you can do that on unstable Rust with untagged unions</p>



<a name="178179878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179878">(Oct 15 2019 at 10:38)</a>:</h4>
<p>Exactly, MaybeUninit isn't magic, just using an unstable feature</p>



<a name="178179887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179887">(Oct 15 2019 at 10:38)</a>:</h4>
<p>(which is being worked on by Oliver atm)</p>



<a name="178179911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179911">(Oct 15 2019 at 10:39)</a>:</h4>
<p>And once "unions fields don't have to be Copy, just must not have drop glue" is implemented and stabilized, you can do it on stable too (with ManuallyDrop)</p>



<a name="178179929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179929">(Oct 15 2019 at 10:39)</a>:</h4>
<p><code>union Foo&lt;T&gt; { t: T }</code>, by the way, won't work after that's implemented</p>



<a name="178179981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178179981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178179981">(Oct 15 2019 at 10:40)</a>:</h4>
<p>Do we get a bound for <code>T</code> ?</p>



<a name="178180005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180005">(Oct 15 2019 at 10:40)</a>:</h4>
<p>No</p>



<a name="178180006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180006">(Oct 15 2019 at 10:40)</a>:</h4>
<p><a href="https://rust-lang.github.io/rfcs/2514-union-initialization-and-drop.html" target="_blank" title="https://rust-lang.github.io/rfcs/2514-union-initialization-and-drop.html">https://rust-lang.github.io/rfcs/2514-union-initialization-and-drop.html</a></p>



<a name="178180012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180012">(Oct 15 2019 at 10:40)</a>:</h4>
<p>MaybeUninit is magic because it can use unstable features on stable, just like anything in libstd</p>



<a name="178180035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180035">(Oct 15 2019 at 10:41)</a>:</h4>
<p>There is quite a bit of code using <code>union Foo&lt;T&gt; { t: T }</code></p>



<a name="178180037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180037">(Oct 15 2019 at 10:41)</a>:</h4>
<p>"using unstable features" is a very low threshold for "magic"</p>



<a name="178180053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180053">(Oct 15 2019 at 10:41)</a>:</h4>
<p>That code is all on nightly and using an unstable feature</p>



<a name="178180068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180068">(Oct 15 2019 at 10:41)</a>:</h4>
<p>Sure, and we can break it</p>



<a name="178180075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180075">(Oct 15 2019 at 10:42)</a>:</h4>
<p>I'm just saying that the breakage might be massive</p>



<a name="178180077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180077">(Oct 15 2019 at 10:42)</a>:</h4>
<p>Also doesn't seem very onerous to transition, rather mechanic?</p>



<a name="178180128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180128">(Oct 15 2019 at 10:42)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> just wait until specialization needs to be rearchitected :P</p>



<a name="178180141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180141">(Oct 15 2019 at 10:42)</a>:</h4>
<p><code>union Foo&lt;T&gt; { t: ManuallyDrop&lt;T&gt; }</code> should work</p>



<a name="178180143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180143">(Oct 15 2019 at 10:42)</a>:</h4>
<p>you ain't seen nothing yet... :D</p>



<a name="178180196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180196">(Oct 15 2019 at 10:43)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> aside: maybe you want in on reviewing <a href="https://github.com/rust-lang/rust/pull/62330" target="_blank" title="https://github.com/rust-lang/rust/pull/62330">https://github.com/rust-lang/rust/pull/62330</a>? seems up your alley</p>



<a name="178180200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180200">(Oct 15 2019 at 10:43)</a>:</h4>
<p>Like, there is quite a bit of code using <code>union U&lt;T, U&gt; { a: T, b: U }</code> as a way to do transmutes in statics</p>



<a name="178180225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180225">(Oct 15 2019 at 10:43)</a>:</h4>
<p>Because <code>mem::transmute</code> isn't a <code>const fn</code></p>



<a name="178180299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180299">(Oct 15 2019 at 10:44)</a>:</h4>
<p>A warning of the type "don't use unions for transmutes, use <code>mem::transmute</code> instead" would help</p>



<a name="178180349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180349">(Oct 15 2019 at 10:45)</a>:</h4>
<p>I'm not a fan of making <code>mem::transmute</code> more magic than it already is</p>



<a name="178180356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180356">(Oct 15 2019 at 10:45)</a>:</h4>
<p>Feel free to implement it but I can't honestly say that this is high on my list of priorities especially when everyone's going to get a reasonable clear compiler error in (hopefully) a few weeks anyway</p>



<a name="178180442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180442">(Oct 15 2019 at 10:46)</a>:</h4>
<p>Starting by the standard library :D</p>



<a name="178180470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180470">(Oct 15 2019 at 10:46)</a>:</h4>
<p>Play stupid games, win stupid prizes</p>



<a name="178180520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180520">(Oct 15 2019 at 10:47)</a>:</h4>
<p>(I assume "it" is referring to the warning and not reviewing <a href="https://github.com/rust-lang/rust/issues/62330" target="_blank" title="https://github.com/rust-lang/rust/issues/62330">#62330</a>)</p>



<a name="178180523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180523">(Oct 15 2019 at 10:47)</a>:</h4>
<p>Not really, since that probably isn't Olis fault, yet the PR that tries to land it will need to fix things there</p>



<a name="178180622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180622">(Oct 15 2019 at 10:48)</a>:</h4>
<p>(Yes, "it" = such a warning)</p>



<a name="178180771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180771">(Oct 15 2019 at 10:50)</a>:</h4>
<p>I'm sure that Oliver would be happy to help if he has the time. He's quite a nice fellow! <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="178180900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180900">(Oct 15 2019 at 10:53)</a>:</h4>
<p>What I was trying to say is that PRs that change nightly features need to change all components that use them for the PR to be merged.</p>



<a name="178180915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180915">(Oct 15 2019 at 10:53)</a>:</h4>
<p>You mentioned specialization before. Whoever tries to land a PR that changes the current semantics would need to workaround everything in the standard library that uses it.</p>



<a name="178180958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180958">(Oct 15 2019 at 10:54)</a>:</h4>
<p>That can be done, but is a lot of work.</p>



<a name="178180987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180987">(Oct 15 2019 at 10:54)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> oh; that seems like a given, yes</p>



<a name="178180989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180989">(Oct 15 2019 at 10:54)</a>:</h4>
<p>The longer the feature remains unstable, particularly when the feature is useful, the larger the problem.</p>



<a name="178180999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178180999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178180999">(Oct 15 2019 at 10:54)</a>:</h4>
<p>but that should mostly be "boring mechanic work"</p>



<a name="178181033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181033">(Oct 15 2019 at 10:55)</a>:</h4>
<p>Yes, that is true. Why are you stressing it? You don't seem to advocate any alternative, or draw other consequences from it. It's a true observation, now what?</p>



<a name="178181099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181099">(Oct 15 2019 at 10:56)</a>:</h4>
<blockquote>
<p>Otherwise MaybeUninit cannot be used with !Copy types<br>
Sure, but MaybeUninit is a union, and if T is not Copy, then that would create an union with a NonCopy field</p>
</blockquote>
<p>you didn't test this, did you? MaybeUninit works fine for all<code>T</code>. it's not always <code>Copy</code> but it works just fine. You rarely want to copy a <code>MaybeUninit</code>.</p>



<a name="178181156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181156">(Oct 15 2019 at 10:57)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> what you are asking for is <a href="https://github.com/rust-lang/rust/pull/62330" target="_blank" title="https://github.com/rust-lang/rust/pull/62330">https://github.com/rust-lang/rust/pull/62330</a></p>



<a name="178181168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181168">(Oct 15 2019 at 10:57)</a>:</h4>
<p>this has nothing to do with MaybeUninit, and only coincidentally anything to do with Copy</p>



<a name="178181226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181226">(Oct 15 2019 at 10:58)</a>:</h4>
<p>ah that has all been said, good :D</p>



<a name="178181242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181242">(Oct 15 2019 at 10:58)</a>:</h4>
<p>Yeah; Oliver just needs to do some $dayjob first :P</p>



<a name="178181251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181251">(Oct 15 2019 at 10:58)</a>:</h4>
<p>(before fixing the stuff in the PR)</p>



<a name="178181257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181257">(Oct 15 2019 at 10:58)</a>:</h4>
<blockquote>
<p>It's a true observation, now what?</p>
</blockquote>
<p>Maybe be more conservative with which unstable features are used from within the toolchain ?</p>



<a name="178181262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181262">(Oct 15 2019 at 10:58)</a>:</h4>
<p>The bar for that is now zero.</p>



<a name="178181275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181275">(Oct 15 2019 at 10:59)</a>:</h4>
<p>so let me just note in closing that <code>MaybeUninit</code> is actually not special-cased in the compiler; rather it's a union where the <code>init</code> field has type <code>ManuallyDrop&lt;T&gt;</code>. which will work in unions for any <code>T</code> once we stabilize it.</p>



<a name="178181297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181297">(Oct 15 2019 at 10:59)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> well except for the <code>repr(transparent)</code> aspect... -ish</p>



<a name="178181306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181306">(Oct 15 2019 at 10:59)</a>:</h4>
<p>yeah well that's a separate story</p>



<a name="178181311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181311">(Oct 15 2019 at 10:59)</a>:</h4>
<p>yep</p>



<a name="178181366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181366">(Oct 15 2019 at 11:00)</a>:</h4>
<p>Why the "-ish" ?</p>



<a name="178181388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181388">(Oct 15 2019 at 11:00)</a>:</h4>
<p>(muffled suppressed ranting about transparent unions)</p>



<a name="178181406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181406">(Oct 15 2019 at 11:00)</a>:</h4>
<p>I thought the RFC was merged</p>



<a name="178181410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181410">(Oct 15 2019 at 11:00)</a>:</h4>
<p>and implemented</p>



<a name="178181418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181418">(Oct 15 2019 at 11:00)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> it is not completely true that it is special cased... it could ostensibly be stabilized for everyone</p>



<a name="178181433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181433">(Oct 15 2019 at 11:01)</a>:</h4>
<p>it's the only thing using the feature tho atm</p>



<a name="178181434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181434">(Oct 15 2019 at 11:01)</a>:</h4>
<p>Did it end up not working for MaybeUninit?</p>



<a name="178181442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181442">(Oct 15 2019 at 11:01)</a>:</h4>
<p>I think it worked?</p>



<a name="178181446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181446">(Oct 15 2019 at 11:01)</a>:</h4>
<p>That's why I thought too</p>



<a name="178181447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181447">(Oct 15 2019 at 11:01)</a>:</h4>
<blockquote>
<blockquote>
<p>It's a true observation, now what?</p>
</blockquote>
<p>Maybe be more conservative with which unstable features are used from within the toolchain ?</p>
</blockquote>
<p>Sure, that is a thing you could advocate. I don't think you'd be very successful, though, absent hard evidence that the effort of updating parts of libstd/rustc when changing some unstable feature is a real problem outweighing the benefit of using that feature.</p>



<a name="178181517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181517">(Oct 15 2019 at 11:02)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> @bjorn3 is trying to get <code>stdarch</code> to work on cranelift</p>



<a name="178181525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181525">(Oct 15 2019 at 11:02)</a>:</h4>
<p>I would probably agree with <span class="user-mention" data-user-id="132920">@gnzlbg</span>'s point when it comes to unordered</p>



<a name="178181540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181540">(Oct 15 2019 at 11:02)</a>:</h4>
<p>let's just say trying to map thousands of <code>link_llvm_intrinsic</code> to cranelift isn't fun</p>



<a name="178181542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181542">(Oct 15 2019 at 11:02)</a>:</h4>
<p>and in some cases I might require tests in tidy or something</p>



<a name="178181572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181572">(Oct 15 2019 at 11:03)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> we're careful about not exposing e.g. specialization in a problematic way tho</p>



<a name="178181581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181581">(Oct 15 2019 at 11:03)</a>:</h4>
<p>and we can always remove those impls</p>



<a name="178181588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181588">(Oct 15 2019 at 11:03)</a>:</h4>
<p>(from a semantic POV)</p>



<a name="178181631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181631">(Oct 15 2019 at 11:04)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> So that sucks, but what's the alternative there that's (1) easier on Cranelift and (2) would have been acceptable during development of std::arch?</p>



<a name="178181667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181667">(Oct 15 2019 at 11:04)</a>:</h4>
<p>We had "platform-intrinsics" before. That would have been easier on Cranelift, and probably miri as well.</p>



<a name="178181679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181679">(Oct 15 2019 at 11:05)</a>:</h4>
<p>I am extremely skeptical</p>



<a name="178181695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178181695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178181695">(Oct 15 2019 at 11:05)</a>:</h4>
<p>In any case this is all hypothetical and I have better things to do</p>



<a name="178309392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/maybeuninit%20not%20copy/near/178309392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/maybeuninit.20not.20copy.html#178309392">(Oct 16 2019 at 17:19)</a>:</h4>
<p>I dont see what intrinsics have to do with <code>MaybeUninit</code> using an unstable union feature though...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>